package com.zhouys.relection;

public class Test6 {

    public static void main(String[] args) throws ClassNotFoundException {
        //        获取系统类加载器
        ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader();
        System.out.println(systemClassLoader);
        //        获取系统扩展类加载器的父类加载器  扩展类加载器
        ClassLoader parent = systemClassLoader.getParent();
        System.out.println(parent);
//        获取扩展类加载器的父类加载器（根加载器C/C++）
        ClassLoader parent1 = parent.getParent();
        System.out.println(parent1);
//        测试当前类是哪个加载器加载的
        ClassLoader classLoader = Class.forName("com.zhouys.relection.Test6").getClassLoader();
        System.out.println(classLoader);
        //测试JDK内置的类是谁加载的
        ClassLoader classLoader1 = Class.forName("java.lang.Object").getClassLoader();
        System.out.println(classLoader1);
        //如何获得 系统类加载的路径
        String property = System.getProperty("java.class.path");
        System.out.println(property);
        /*
        D:\java\jre\lib\charsets.jar;D:\java\jre\lib\deploy.jar;
        D:\java\jre\lib\ext\access-bridge-64.jar;
        D:\java\jre\lib\ext\cldrdata.jar;
        D:\java\jre\lib\ext\dnsns.jar;
        D:\java\jre\lib\ext\jaccess.jar;
        D:\java\jre\lib\ext\jfxrt.jar;
        D:\java\jre\lib\ext\localedata.jar;
        D:\java\jre\lib\ext\nashorn.jar;
        D:\java\jre\lib\ext\sunec.jar;
        D:\java\jre\lib\ext\sunjce_provider.jar;
        D:\java\jre\lib\ext\sunmscapi.jar;
        D:\java\jre\lib\ext\sunpkcs11.jar;
        D:\java\jre\lib\ext\zipfs.jar;
        D:\java\jre\lib\javaws.jar;
        D:\java\jre\lib\jce.jar;
        D:\java\jre\lib\jfr.jar;
        D:\java\jre\lib\jfxswt.jar;
        D:\java\jre\lib\jsse.jar;
        D:\java\jre\lib\management-agent.jar;
        D:\java\jre\lib\plugin.jar;
        D:\java\jre\lib\resources.jar;
        D:\java\jre\lib\rt.jar;H:\java\zhouys\out\production\zhouys;
        D:\chengxuyingyong\javaidea\IntelliJ IDEA 2020.1\lib\idea_rt.jar
         */

    }
}
